Skip to content

Refactoring eip-4844 #2752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 7, 2025
Merged

Conversation

anvacaru
Copy link
Contributor

@anvacaru anvacaru commented Apr 29, 2025

EIP-4844 Blob Validation Implementation

This PR implements missing blob gas validation for EIP-4844 and adds some checks for transaction and block validity:

Transaction Validation

  • Added #isValidTransaction to check transaction validity before starting to execute it, included missing checks as defined in ethereum/execution-specs
  • Implemented blob fee deduction with new #deductBlobGas operation
  • Added versioned hash validation via #checkTxVersionedHashes

Block Validation

  • Added #validateBlockBlobs to verify total blob count and excess blob gas
  • Added state transitions via #finalizeBlockBlobs for block-level validation
  • Tracks blob gas values between blocks with previousExcessBlobGas and previousBlobGasUsed cells

Gas Calculations

  • Moved blob gas calculation functions from evm.md to gas.md:
    • Ctotalblob - calculates gas used per blob
    • Cbasefeeperblob - computes blob base fee
    • Cblobfee - calculates total blob fee
    • Cexcessblob - maintains excess blob gas between blocks

Error Handling

  • Added EVMC_INVALID_BLOCK status code for blob validation failures

This implementation ensures that KEVM correctly rejects blocks with invalid blob gas parameters, matching Ethereum consensus rules.

The EIP-7691 from Pectra will update the values of the schedule vars added here.

@anvacaru anvacaru marked this pull request as ready for review April 30, 2025 16:32
Copy link
Collaborator

@Robertorosmaninho Robertorosmaninho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Robertorosmaninho
Copy link
Collaborator

Sorry, I've accidently closed the PR.

@automergerpr-permission-manager automergerpr-permission-manager bot merged commit 183e857 into master May 7, 2025
12 checks passed
@automergerpr-permission-manager automergerpr-permission-manager bot deleted the eip-4844-refactor branch May 7, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants